package com.kantboot.business.shop.web.i18n.web.controller;

import com.kantboot.business.shop.domain.i18n.BusShopGoodsTypeI18n;
import com.kantboot.business.shop.service.IBusShopGoodsTypeI18nService;
import com.kantboot.global.rest.result.CommonSuccessStateCodeAndMsg;
import com.kantboot.util.common.result.RestResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/business-shop-web/admin/shopGoodsTypeI18n")
public class BusShopI18nControllerOfAdmin {

    @Resource
    private IBusShopGoodsTypeI18nService service;

    @RequestMapping(value = "/newSave")
    public RestResult<?> newSave(@RequestBody BusShopGoodsTypeI18n busShopGoodsTypeI18n) {
        return RestResult.success(service.newSave(busShopGoodsTypeI18n), CommonSuccessStateCodeAndMsg.SAVE_SUCCESS);
    }

    @RequestMapping(value = "/clearFileIdOfIconByLanguageCodeAndGoodsTypeId")
    public RestResult<?> clearFileIdOfIconByLanguageCodeAndGoodsTypeId(
            @RequestBody BusShopGoodsTypeI18n busShopGoodsTypeI18n) {
        service.clearFileIdOfIconByLanguageCodeAndGoodsTypeId(busShopGoodsTypeI18n.getLanguageCode(), busShopGoodsTypeI18n.getGoodsTypeId());
        return RestResult.success(null, CommonSuccessStateCodeAndMsg.SAVE_SUCCESS);
    }

}
